/* GUI CONVERTED from reopiq02.p (converter v1.76) Fri Aug 17 03:56:10 2001 */
/* reopiq02.p - REPETITIVE                                                    */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.6.3.5 $                                                         */
/*V8:ConvertMode=Report                                              */
/* REVISION: 7.3    LAST MODIFIED: 10/31/94   BY: WUG *GN77*                  */
/* REVISION: 7.3    LAST MODIFIED: 11/08/94   BY: WUG *GN98*                  */
/* REVISION: 7.3    LAST MODIFIED: 01/06/95   BY: cpp *FT95*                  */
/* REVISION: 7.3    LAST MODIFIED: 03/14/95   By: DZN *G0G8*                  */
/* REVISION: 7.3    LAST MODIFIED: 03/31/95   BY: JPM *G0K2*                  */
/* REVISION: 7.3    LAST MODIFIED: 05/16/96   BY: *G1VG* Julie Milligan       */
/* REVISION: 7.3    LAST MODIFIED: 05/16/96   BY: *G2B4* Julie Milligan       */
/* REVISION: 7.4    LAST MODIFIED: 01/07/97   BY: *H0QQ* Julie Milligan       */
/* REVISION: 8.6    LAST MODIFIED: 10/10/97   BY: bvm *K0R0*                  */
/* REVISION: 8.6E   LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane            */
/* REVISION: 8.6E   LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan           */
/* REVISION: 9.1    LAST MODIFIED: 10/01/99   BY: *N014* Jeff Wootton         */
/* REVISION: 9.1    LAST MODIFIED: 10/25/99   BY: *N002* Bill Gates           */
/* REVISION: 9.1    LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane     */
/* REVISION: 9.1    LAST MODIFIED: 08/12/00   BY: *N0KP* myb                  */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* Old ECO marker removed, but no ECO header exists *K0R0*                    */
/* $Revision: 1.6.3.5 $    BY: Hiral Kadakia   DATE: 07/24/01 ECO: *N10F*            */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* OPERATION HISTORY DETAIL INQUIRY                                           */


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE reopiq02_p_1 "From Operation"
/* MaxLen: Comment: */

&SCOPED-DEFINE reopiq02_p_2 "Qty Adjusted"
/* MaxLen: Comment: */

&SCOPED-DEFINE reopiq02_p_3 "Effective"
/* MaxLen: Comment: */

&SCOPED-DEFINE reopiq02_p_4 "Line"
/* MaxLen: Comment: */

&SCOPED-DEFINE reopiq02_p_5 "BOM"
/* MaxLen: Comment: */

&SCOPED-DEFINE reopiq02_p_6 "Downtime Reason"
/* MaxLen: Comment: */

&SCOPED-DEFINE reopiq02_p_7 "Adjust Reason"
/* MaxLen: Comment: */

&SCOPED-DEFINE reopiq02_p_10 "Routing"
/* MaxLen: Comment: */

&SCOPED-DEFINE reopiq02_p_11 "Qty Moved"
/* MaxLen: Comment: */

&SCOPED-DEFINE reopiq02_p_12 "Qty Scrapped"
/* MaxLen: Comment: */

&SCOPED-DEFINE reopiq02_p_13 "Qty Processed"
/* MaxLen: Comment: */

&SCOPED-DEFINE reopiq02_p_14 "Scrap Reason"
/* MaxLen: Comment: */

&SCOPED-DEFINE reopiq02_p_15 "Work Ctr"
/* MaxLen: Comment: */

&SCOPED-DEFINE reopiq02_p_16 "Dr Acct!Cr Acct"
/* MaxLen: 17 Comment: Dr Account (max 8) and Cr account (max 8) */

&SCOPED-DEFINE reopiq02_p_17 "Sub-Acct!Sub-Acct"
/* MaxLen: 17 Comment: Dr Sub-account (max 8) and Cr Sub-account */

&SCOPED-DEFINE reopiq02_p_18 "CC!CC"
/* MaxLen: 9 Comment: Dr Cost Center (max 4) and Cr Cost Center */

&SCOPED-DEFINE reopiq02_p_19 "Project!Project"
/* MaxLen: 17 Comment: Dr Project (max 8) and Cr Project */

/* ********** End Translatable Strings Definitions ********* */

/*V8:DontRefreshTitle=a1 */

define variable optime              as   character.
define variable trnbr               like op_trnbr format ">>>>>>>9".
define variable name                as   character format "x(34)".
define variable reason_type         as   character.
define variable h_wiplottrace_funcs as   handle no-undo.

{wlfnc.i} /* FUNCTION FORWARD DECLARATIONS */


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
trnbr          colon 17
   format         ">>>>>>>9"
with side-labels frame a width 80 NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

FORM /*GUI*/ 
   op_type              colon 13
   op_tran_date         colon 43
   optime               no-label
   op_emp               colon 13
   op_date              colon 43 label {&reopiq02_p_3}
   op_shift             colon 59
   op_site              colon 68
   op_part              colon 13
   op_wo_op             colon 43
   op_line              colon 68 label {&reopiq02_p_4}
   wo_routing           colon 13 label {&reopiq02_p_10}
   wo_bom_code          colon 43 label {&reopiq02_p_5}
   op_wo_lot            colon 68
   op_wkctr             colon 13 label {&reopiq02_p_15}
   op_mch               colon 43
   op_dept              colon 68
   skip(1)
   op_qty_comp          colon 18 label {&reopiq02_p_13}
   op_qty_wip           colon 18 label {&reopiq02_p_11}
   op__chr02            colon 55 label {&reopiq02_p_1}
   op_qty_rjct          colon 18
   op_rsn_rjct          colon 55
   op_qty_rwrk          colon 18
   op_rsn_rwrk          colon 55
   op__dec01            colon 18 label {&reopiq02_p_12}
   format "->,>>>,>>9.9<<<<<<<<"
   op_rsn               colon 55 label {&reopiq02_p_14}
   op__dec02            colon 18 label {&reopiq02_p_2}
   format "->,>>>,>>9.9<<<<<<<<"
   op_rsn_adjust        colon 55 label {&reopiq02_p_7}
   skip(1)
   op_act_run           colon 18
   op_earn              colon 55
   op_act_setup         colon 18
   op__chr01            colon 55 label {&reopiq02_p_6}
with STREAM-IO /*GUI*/  side-labels frame a1 width 80        BGCOLOR 8    .

/* SET EXTERNAL LABELS */
setFrameLabels(frame a1:handle).

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
op_lbr_std           colon 18
   op_lbr_cost          colon 55
   op_bdn_std           colon 18
   op_bdn_cost          colon 55
   op_sub_std           colon 18
   op_sub_cost          colon 55
         skip (.4)   
with frame a2 width 80 side-labels
   /*V8+*/
overlay no-underline
 NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a2-title AS CHARACTER.
 F-a2-title = (getFrameTitle("LABOR/BURDEN/SUBCONTRACT_COSTS",78)).
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a2 = F-a2-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a2 =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a2 + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a2 =
  FRAME a2:HEIGHT-PIXELS - RECT-FRAME:Y in frame a2 - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a2 = FRAME a2:WIDTH-CHARS - .5. /*GUI*/


/* SET EXTERNAL LABELS */
setFrameLabels(frame a2:handle).

find last op_hist
   where op_trnbr >= 0
no-lock no-error.

if available op_hist
then do:
   trnbr = op_trnbr.
   {reopiq02.i}
end.

{wbrp01.i}

repeat with frame a:

   if c-application-mode <> 'web'
   then
      update
         trnbr
      with frame a
   editing:

      {mfnp.i op_hist trnbr op_trnbr trnbr op_trnbr op_trnbr}

      if recno <> ?
      then do:
         find pt_mstr no-lock
            where pt_part = op_part
         no-error.

         find emp_mstr no-lock
            where emp_addr = op_emp
         no-error.
         {reopiq02.i}
      end.
   end.

   {wbrp06.i &command = update &fields = "  trnbr" &frm = "a"}

   if (c-application-mode <> 'web') or
      (c-application-mode = 'web' and
      (c-web-request begins 'data'))
   then do:

      find op_hist no-lock
         where op_trnbr = trnbr
      no-error.

      if not available op_hist
      then do:
         clear frame a1.
         {pxmsg.i &MSGNUM=13 &ERRORLEVEL=3}
         if c-application-mode = 'web'
         then
            return.
         undo , retry.
      end.

      find pt_mstr no-lock
         where pt_part = op_part
      no-error.
      find emp_mstr no-lock
         where emp_addr = op_emp
      no-error.
      {reopiq02.i}

   end.

   /* OUTPUT DESTINATION SELECTION */
   {gpselout.i &printType = "terminal"
               &printWidth = 80
               &pagedFlag = " "
               &stream = " "
               &appendToFile = " "
               &streamedOutputToTerminal = " "
               &withBatchOption = "no"
               &displayStatementType = 1
               &withCancelMessage = "yes"
               &pageBottomMargin = 6
               &withEmail = "yes"
               &withWinprint = "yes"
               &defineVariables = "yes"}
/*GUI*/ RECT-FRAME:HEIGHT-PIXELS in frame a = FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.


   /* MOVED THE FOLLOWING UP A LINE */
   {reopiq02.i}

   /*V8+*/

   display
      op_lbr_std
      op_lbr_cost
      op_bdn_std
      op_bdn_cost
      op_sub_std
      op_sub_cost
   with frame a2 STREAM-IO /*GUI*/ .

   for each opgl_det no-lock
      where opgl_trnbr = op_trnbr
      with frame b width 80
      /*V8+*/
      overlay no-underline
            bgcolor 8   
      title color normal (getFrameTitle("G/L_TRANSACTIONS",24)):

      /* SET EXTERNAL LABELS */
      setFrameLabels(frame b:handle).

      if opgl_gl_amt >= 0
      then do:
         display
            space(7)
            opgl_gl_ref
            opgl_gl_amt
            opgl_dr_acct
            column-label {&reopiq02_p_16}
            opgl_dr_sub
            column-label {&reopiq02_p_17}
            opgl_dr_cc
            column-label {&reopiq02_p_18}
            opgl_dr_proj
            column-label {&reopiq02_p_19} WITH STREAM-IO /*GUI*/ .
         down 1.
         display
            "" @ opgl_gl_ref
            "" @ opgl_gl_amt
            opgl_cr_acct @ opgl_dr_acct
            opgl_cr_sub @ opgl_dr_sub
            opgl_cr_cc @ opgl_dr_cc
            opgl_cr_proj @ opgl_dr_proj WITH STREAM-IO /*GUI*/ .
      end.
      else do:
         display
            opgl_gl_ref
            opgl_gl_amt * -1 @ opgl_gl_amt
            opgl_cr_acct @ opgl_dr_acct
            opgl_cr_sub @ opgl_dr_sub
            opgl_cr_cc @ opgl_dr_cc
            opgl_cr_proj @ opgl_dr_proj WITH STREAM-IO /*GUI*/ .
         down 1.
         display
            "" @ opgl_gl_ref
            "" @ opgl_gl_amt
            opgl_dr_acct
            opgl_dr_sub
            opgl_dr_cc
            opgl_dr_proj WITH STREAM-IO /*GUI*/ .
      end.

   end.

   hide frame b.
   hide frame a2.

   if is_wiplottrace_enabled()
   then do:
      {gprunmo.i
         &program=""reopiqa.p""
         &module="AWT"
         &param="""(input recid(op_hist))"""}
   end.

         view frame a1.   

   {mfreset.i}
/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/

   {pxmsg.i &MSGNUM=8 &ERRORLEVEL=1}
   status input.
end.

{wbrp04.i &frame-spec = a}
